package file;


import java.io.File;
public class RecursionDeleteDir
{
    public static void main(String[] args)
    {
        File file = new File("a/c/d/e/f");
        if (!file.exists())
        {
            file.mkdirs();
        }
        File file1  = new File("a");
        deleteDirs(file1);


    }
    // 递归删除目录
    public static boolean deleteDirs(File dirs)
    {
        if (!dirs.exists())
            return false;
        if (dirs.isFile())
            return dirs.delete();

        File[] files = dirs.listFiles();
        if (files != null)
        {
            for (File file : files)
            {
                deleteDirs(file);
            }
        }
        return dirs.delete();

    }
}
